package com.atguigu.gmall.product.controller;

import com.atguigu.gmall.common.minio.service.OSSService;
import com.atguigu.gmall.common.result.Result;


import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2024/9/7 1:01
 */
@Slf4j
@RestController
@RequestMapping("/admin/product")
public class FileController {
    @Autowired
    MinioClient minioClient;
    @Autowired
    OSSService ossService;
    @PostMapping("/fileUpload")
    public Result upload(MultipartFile file) {

        String path=ossService.uploadFile(file);

        return Result.ok(path);
    }
}
